package com.yawn.zddefect.controller;

import com.yawn.zddefect.controller.entity.DefectExport;
import com.yawn.zddefect.controller.entity.RestResponse;
import com.yawn.zddefect.service.HistoricalService;
import com.yawn.zddefect.util.WebUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.List;

@RestController
@RequestMapping("/his")
public class HistoricalController {

    @Resource
    private HistoricalService historicalService;

    @GetMapping("/started")
    public RestResponse myStarted(String userId, int first, int size) {
        return historicalService.myStarted(userId, first, size);
    }

    @GetMapping("/finished")
    public RestResponse myFinished(String userId, int first, int size) {
        return historicalService.myFinished(userId, first, size);
    }

    @GetMapping("/list")
    public RestResponse listDefect(String proCode, int first, int size) {
        return historicalService.listDefect(proCode, first, size);
    }

    @GetMapping("/export")
    public List<DefectExport> export(String proCode) {
        return historicalService.exportByPro(proCode);
    }

}
